<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>3D旋转呈现-3D导航栏案例</title>
        <style>
            * {
                margin: 0;
                padding: 0;
            }

            ul {
                margin: 100px;
            }

            ul li {
                float: left;
                margin: 0 5px;
                width: 120px;
                height: 35px;
                list-style: none;
                /* 一会需要给box 旋转 也需要透视 干脆给li加 里面的子盒子都有透视效果 */
                perspective: 500px;
            }

            .box {
                position: relative;
                width: 100%;
                height: 100%;
                transform-style: preserve-3d;
                transition: all 0.4s;
            }

            .box:hover {
                transform: rotateX(90deg);
            }

            .front,
            .bottom {
                position: absolute;
                left: 0;
                top: 0;
                width: 100%;
                height: 100%;
            }

            .front {
                background-color: pink;
                z-index: 1;
                transform: translateZ(17.5px);
            }

            .bottom {
                background-color: purple;
                color: bisque;
                /* 这个x轴一定是负值 */
                /* 如果有移动 或者其他样式，必须先写移动 */
                transform: translateY(17.5px) rotateX(-90deg);
            }
        </style>
    </head>

    <body>
        <ul>
            <li>
                <div class="box">
                    <div class="front">MooN</div>
                    <div class="bottom">Zero</div>
                </div>
            </li>
            <li>
                <div class="box">
                    <div class="front">MooN</div>
                    <div class="bottom">Zero</div>
                </div>
            </li>
            <li>
                <div class="box">
                    <div class="front">MooN</div>
                    <div class="bottom">Zero</div>
                </div>
            </li>
            <li>
                <div class="box">
                    <div class="front">MooN</div>
                    <div class="bottom">Zero</div>
                </div>
            </li>
            <li>
                <div class="box">
                    <div class="front">MooN</div>
                    <div class="bottom">Zero</div>
                </div>
            </li>
            <li>
                <div class="box">
                    <div class="front">MooN</div>
                    <div class="bottom">Zero</div>
                </div>
            </li>
        </ul>
    </body>
</html>
